/*
 * @LastEditors: yuSeen
 * @LastEditTime: 2021-12-04 16:42:46
 * 天凉好个秋
 */
const config = {
  //服务端口
  server: {
    port: Number(process.env.SERVER_PORT),
  },

  //数据库配置
  db: {
    db_host: process.env.DB_HOST,
    db_port: process.env.DB_PORT,
    db_name: process.env.DB_NAME,
    db_user: process.env.DB_USER,
    db_password: process.env.DB_PASSWORD,
  },

  //日志配置
  log: { 
    appenders: {
      cheese: { type: "file", filename: "log/cheese.log" },
      access: { type: "dateFile", filename: "log/access.log", layout: { type: "colored" }, pattern: ".yyyy-MM-dd" },
      db: { type: "dateFile", filename: "log/db.log", layout: { type: "colored" }, pattern: ".yyyy-MM-dd" }
    },
    categories: {
      default: { appenders: ["access"], level: "info" },
      access: { appenders: ["access"], level: "info" },
      db: { appenders: ["db"], level: "info" }
    }
  },

  // jwt配置
  jwt: {
    secret: process.env.JWT_SECRET,
    expire: process.env.JWT_EXPIRE
  },

  // 权限相关
  permission: {
    // 权限数据缓存刷新的时间，默认两分钟刷新一次
    refreshTime: 1000 * 60 * 2
  }
};

export default config;
